package com.rjgc.title.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.rjgc.title.common.util.DateUtil;
import com.rjgc.title.mapper.TeachingSituationMapper;
import com.rjgc.title.model.entity.apply.TeachingSituation;
import com.rjgc.title.model.entity.student.TrainingExperience;
import com.rjgc.title.service.TeachingSituationService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * <p>
 * 教学情况 服务实现类
 * </p>
 *
 * @author 卓抱抱
 * @since 2022-04-25
 */
@Service
public class TeachingSituationServiceImpl extends ServiceImpl<TeachingSituationMapper, TeachingSituation> implements TeachingSituationService {

    @Autowired
    private TeachingSituationMapper teachingSituationMapper;
    /**
     *
     * @param userId
     * @return
     */
    @Override
    public List<TeachingSituation> getAll(String userId) {

        QueryWrapper<TeachingSituation> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("userId",userId);
        queryWrapper.eq("year", DateUtil.getYear(new Date()));
        List<TeachingSituation> trainingExperiences = teachingSituationMapper.selectList(queryWrapper);
        return trainingExperiences;
    }
}
